﻿#ifndef _REC_READ_AVI_H_
#define _REC_READ_AVI_H_

#include <stdint.h>
#include "rec_read_base.h"
#include "avilib.h"

using namespace std;



class CRecRead_avi:public CRecReadBase
{
public:
	CRecRead_avi(int buf_size,int clientID,int channel);
	CRecRead_avi();
	~CRecRead_avi();

    virtual	int Open(const char * file_path, int64_t startTime = 0, int64_t endTime = 0,bool bClearBuf = false);

	void Close(bool bImmediate =false);
	virtual int SeekToTime(int64_t time, bool bClear = true) ;
	virtual int ReadFrame(unsigned char* buf, uint32_t bufLen);
protected:
	virtual int ReadFIFONormal();

	virtual int ReadFIFO2Forward();
	
	virtual int ReadFIFOForward();
	
	virtual int ReadFIFOReback();

	//由于存储在文件当中的音频是针对ASF文件编码的格式，但是在网络传输的需要使用RTP的方式
public:
	virtual bool IsOpen();
private:
	string  file;
	avi_t*  m_fd = NULL;
};
#endif //_REC_READ_BASE_H_
